// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   BusSencond.java

package include.tree_index;

import include.nseer_db.nseer_db;
import java.sql.ResultSet;
import java.util.Hashtable;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpSession;

public class BusSencond
{

	public BusSencond()
	{
	}

	public String getLang(String tablename, String column, String unit_db_name, HttpSession session, ServletContext context)
	{
		String value = "";
		try
		{
			String type = (String)session.getAttribute("language");
			if (type == null)
				type = "chinese";
			type = (new StringBuilder("multilanguage_")).append(tablename).append("_").append(type).toString();
			Hashtable tt = (Hashtable)context.getAttribute(type);
			if (tt == null)
			{
				value = column;
				tt = new Hashtable();
				tt.put(column, column);
				context.setAttribute(type, tt);
				nseer_db db = new nseer_db(unit_db_name);
				String sql22 = (new StringBuilder("select * from document_multilanguage where tablename='")).append(tablename).append("' and name='").append(column).append("'").toString();
				ResultSet rs22 = db.executeQuery(sql22);
				if (!rs22.next())
				{
					String sql1 = (new StringBuilder("insert into document_multilanguage(tablename,name)values('")).append(tablename).append("','").append(column).append("')").toString();
					db.executeUpdate(sql1);
				}
				db.close();
			}
			value = (String)tt.get(column);
			if (value == null)
			{
				value = column;
				tt.put(column, column);
				context.setAttribute(type, tt);
				nseer_db db = new nseer_db(unit_db_name);
				String sql22 = (new StringBuilder("select * from document_multilanguage where tablename='")).append(tablename).append("' and name='").append(column).append("'").toString();
				ResultSet rs22 = db.executeQuery(sql22);
				if (!rs22.next())
				{
					String sql1 = (new StringBuilder("insert into document_multilanguage(tablename,name)values('")).append(tablename).append("','").append(column).append("')").toString();
					db.executeUpdate(sql1);
				}
				db.close();
			}
		}
		catch (Exception r)
		{
			r.printStackTrace();
		}
		return value;
	}
}
